#pragma once

#include "dib.h"
#include "tabcontrol.h"

/** 
 * \ingroup ti6
 *
 * \brief
 * The ImageTab stores information specific for an image tab page (an
 * opened image). It is used by MainWindow's instance of TabControl, to
 * identify a tab page containing an image.
 * The image itself is showed by ImageBox (which has a single instance in
 * the application).
 *
 * Copyright (c) Academie voor ICT en Media 2007 - 2008
 */
class ImageTab: public TabControl::Tab
{
public:
	/**
	 \brief
	 Default constructor.
	 */
	ImageTab();

	/**
	 \brief
	 Destructor. This does the delete the filename, but not the opened DIB.
	 */
	virtual ~ImageTab();

	/**
	 \brief
	 Request whether the image, which is open in this tab, has any unsaved changes.
	 
	 \return True is returned if there are unsaved changes. False is returned
	   otherwise.
	 */
	bool hasUnsavedChanges() const;

	/**
	 \brief
	 Set the unsaved changes flag. Set this to true if the image is changed. When
	 changes are saved, the flag should be set to false.
	 
	 \param value The new value of the unsaved changes flag.
	 */
	void setHasUnsavedChanges( bool value );

	/**
	 \brief
	 Get the file name of the image, which is opened in this tab. This file name
	 is stored as a wide character string.
	 
	 \return The file name.
	 */
	wchar_t* fileName();

	/**
	 \brief
	 Set the file name of the image, which is opened in this tab. This file name
	 is stored as a wide character string.
	 
	 \param *fileName The file name.
	 */
	void setFileName( wchar_t *fileName );

	/**
	 \brief
	 Get the DIB instance, which represents the image opened in this tab.
	 
	 \return A pointer to the DIB.
	 */
	DIB* dib();

	/**
	 \brief
	 Set the DIB instance, which represents the image opened in this tab. The
	 ImageTab instance does not take ownership of the DIB.
	 
	 \param *dib A pointer to a DIB.
	 */
	void setDib( DIB *dib );

private:
	/**
	 The unsaved changes flag.
	 */
	bool _hasUnsavedChanges;

	/**
	 The file name of the image, stored as a wide character string.
	 */
	wchar_t *_fileName;

	/**
	 A pointer to the DIB. This instance does not have ownership of the DIB.
	 */
	DIB *_dib;
};
